<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title>条件运算符的使用</title>
</head>

<body>
<script type="text/javascript">
var year = 2017;//定义年份变量
result = (year%4 == 0 && year%100 != 0) || (year%400 == 0)?"是闰年":"不是闰年";//应用条件运算符进行判断
alert(year+"年"+result);//输出判断结果
</script>

</body>
</html>
